#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "mujs.h"
#include "raylib.h"

#define NOB_IMPLEMENTATION
#include "nob.h"

void *js_Malloc(void *memctx, void *ptr, int size)
{
    return realloc(ptr, size);
}

static const char *console_js =
    "var console = {log: print, debug: print, warn: print, error: print};";

static void jsB_background(js_State *J)
{
    // ClearBackground((Color) {
    //     .r =
    // });
}

static void jsB_print(js_State *J)
{
}

int main(int argc, char **argv)
{
    int ret;
    js_State *J = js_newstate(NULL, NULL, 0);
    assert(J != NULL);

    js_newcfunction(J, jsB_print, "print", 0);
    js_setglobal(J, "print");

    ret = js_dostring(J, console_js);
    assert(ret == 0);

    return 0;
}